# Contributor: Orhun Parmaksız <orhunparmaksiz@gmail.com>
# Maintainer: Orhun Parmaksız <orhunparmaksiz@gmail.com>
pkgname=tere
pkgver=1.5.1
pkgrel=0
pkgdesc="Terminal file explorer"
url="https://github.com/mgunyho/tere"
arch="all !s390x" # FTBFS
license="EUPL-1.2"
makedepends="
	cargo
	cargo-auditable
	"
subpackages="
	$pkgname-doc
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/mgunyho/tere/archive/v$pkgver.tar.gz
	deps.patch
	"
options="net"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	# https://github.com/mgunyho/tere/issues/90
	# https://github.com/mgunyho/tere/issues/93
	cargo test --frozen -- \
		--skip "test_case_sensitive_mode_change" \
		--skip "panic_guard" \
	  --skip "first_run_prompt_accept" \
	  --skip "output_on_exit_without_cd" \
	  --skip "first_run_prompt_cancel" \
	  --skip "basic_run"
}

package() {
	install -Dm 755 target/release/tere -t "$pkgdir"/usr/bin
	install -Dm 644 README.md -t "$pkgdir"/usr/share/doc/$pkgname
	install -Dm 644 ./demo/* -t "$pkgdir"/usr/share/dox/$pkgname/demo
	install -Dm 644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}

sha512sums="
e9ede9284ba2b8ed3749dbbaaa96a3d3963bca6cf4ba7ad03e3df42bb2130a0a8348367cbaa1798ec958145fd54fb3c7aa69354ab1e4c0fbe037e3b1717e717f  tere-1.5.1.tar.gz
97acb6af2944baaac15c9b2f67944e0f2b571fa912009467824a1f9701198e7072e0edaf2411be8c05baa760ff83363179de2e0620a50c51fa8d3e7a1ca56549  deps.patch
"
